file button: Don't leak rows
authorMatthias Clasen <mclasen@redhat.com>
Fri, 5 Jan 2018 16:09:04 +0000 (11:09 -0500)
committerDaniel Boles <dboles@src.gnome.org>
Sun, 7 Jan 2018 16:38:42 +0000 (16:38 +0000)
The file chooser button manually manages the memory of
data in its model, so it needs to explicitly free the
rows.

gtk/gtkfilechooserbutton.c

index e5c0225157f20151c9e88dedf516e0342c80f109..42a8abb84ede84579c7a895290658189d7b98cc3 100644 (file)
@@ -994,8 +994,11 @@ gtk_file_chooser_button_finalize (GObject *object)
   if (priv->current_folder_while_inactive)
     g_object_unref (priv->current_folder_while_inactive);
 
-  if (priv->model != NULL)
-    g_object_unref (priv->model);
+  if (priv->model)
+    {
+      model_remove_rows (button, 0, gtk_tree_model_iter_n_children (priv->model, NULL));
+      g_object_unref (priv->model);
+    }
 
   G_OBJECT_CLASS (gtk_file_chooser_button_parent_class)->finalize (object);
 }